import request from "@/utils/request";

interface productListParams {
  publishStatus: number,
  current?: number,
  pageSize?: number,
  name?: string,
}
export const getProduct = (params:productListParams) => {
  return request({
    url: "/api/product/queryProductList",
    method: "get",
    params
  })
}
interface updateProductStatusParams {
  ids:Array<number>,
  status:number
}
export const updateProductStatus = (data:updateProductStatusParams) => {
  return request({
    url: "/api/product/updatePublishStatus",
    method: "post",
    data
  })
}
interface addProductParams {
  name?:string,
  description?:string,
  productCategoryName?:string,
  pic?:string,
  albumPics?:string,
  price?:number,
  originalPrice?:number,
  stock?:number,
  sort?:number,
  publishStatus?:number,
}
export const addProduct = (data:addProductParams) => {
  return request({
    url: "/api/product/addProduct",
    method: "post",
    data
  })
}
interface updateProductParams {
  id?:number,
  name?:string,
  description?:string,
  productCategoryName?:string,
  pic?:string,
  albumPics?:string,
  price?:number,
  originalPrice?:number,
  stock?:number,
  sort?:number,
  publishStatus?:number,
}
export const updateProduct = (data:updateProductParams) => {
  return request({
    url: "/api/product/updateProduct",
    method: "post",
    data
  })
}

export const uploadImg = (data: any) => {
  return request({
    url: "/api/picture/upload",
    method: "post",
    data
  })
}



// interface deleteBlogParams {
//   ids:Array<number>
// }
// export const deleteBlog = (data:deleteBlogParams) => {
//   return request({
//     url: "/api/cms/Product/deleteBlog",
//     method: "post",
//     data
//   })
// }